<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>注册</title>
    <script rel="script" src="../js/pho.js" type="text/javascript">

    </script>
    <link href="../css/index.css" rel="stylesheet" type="text/css">
</head>
<body onload="lun()">
<form action="zhu.php" method="post">

<div align="center"><img class="top1" src="../tupian/top1.png">
<div><img class="top3" src="../tupian/top2.png"></div>
<div style="height: 15px;">
    <a href="index.php"><div class="a1">首页 </div></a>
    <a href="index1.php"> <div class="a2">环境与资源</div></a>
    <a href="index2.php"><div class="a2">经济概述</div></a>
    <a href="index3.php"> <div class="a2">旅游景点</div></a>
    <a href="index4.php"> <div  class="a2">历史文化</div></a>
</div><hr>
<div class="z1">
<div><img class="z2" src="../tupian/61.jpg"></div>
    <div class="z3">
        <div>用户注册</div>
        <p>选择类型：
        <select style="width: 150px;height: 22px;text-align-last: center">
            <option value="用户">用户</option>
            <option value="管理员">管理员</option>
        </select></p>
        <p>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：<input type="text" name="name"></p>
        <div>昵&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称：<input type="text"></div>
        <p>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：<input type="password" name="mm1"></p>
        <div>确认密码：<input type="password" name="mm2"></div>
        <p>性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别：
            <select style="width: 155px;height: 22px;text-align-last: center">
                <option value="男">男</option>
                <option value="女">女</option>
            </select></p>
        <div>Q&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Q：<input type="text"oninput="value=value.replace(/[^\d]/g,'')"></div>
        <p>手机号码：<input type="text" oninput="value=value.replace(/[^\d]/g,'')"></p>                                <!--只允许数字-->
        <p><input type="submit"; value="立即注册" style="width: 230px;height: 30px;" name="deng"></p>
    </div>
</div>
    <div class="d1">
        <div class="d2">
            <div align="center" class="d3">合作</div>
            <a href="he1.php"><div align="center" class="d4">关于我们</div></a>
            <a href="he2.php"><div align="center" class="d4">联系我们</div></a>
        </div>
        <div class="d2">
            <div align="center" class="d3">官方</div>
            <a href="guan1.php"><div align="center" class="d4">新浪微博</div></a>
            <a href="guan2.php"><div align="center" class="d4">官方微信</div></a>
        </div>
        <div class="d2">
            <div align="center" class="d3">反馈</div>
            <a href="fan1.php"><div align="center" class="d4">帮助中心</div></a>
            <a href="fan2.php"><div align="center" class="d4">用户反馈</div></a>
        </div>
    <div class="l1">Copyright &copy;2019-2020&nbsp;&nbsp;作者：信息学院，B1831，刘泽庆</div>
</div>
</form>
</body>
</html>
<?php
session_start();
if($_SERVER['REQUEST_METHOD']='POST'&&isset($_POST['name'])){
    $_SESSION['username']=$_POST['name'];
    $_SESSION['mm1']=$_POST['mm1'];
    $_SESSION['mm2']=$_POST['mm2'];
    $name=$_POST['name'];
}
if($_SERVER['REQUEST_METHOD']='POST'){

    if(empty($name)&&isset($_POST['deng'])){
        echo "<script>alert('用户名不能为空')</script>";
        exit;
    }
}


if(isset($_POST['deng'])&&$_SESSION['mm1']==$_SESSION['mm2']){
    header("location:index.php");
}
if(isset($_POST['deng'])&&$_SESSION['mm1']!=$_SESSION['mm2'])
{
    header("location:zhu2.php");
}
?>